<?php

class MY_Controller extends Controller {

    var $_data = FALSE;
    var $container = "container";

    function MY_Controller() {
        parent::Controller();
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->helper('jaco_helper');
        $this->load->library('pagination');
        $this->load->library('session');
        $this->load->library('form_validation');
    }

    function display_view($path) {
        $this->_data['view_path'] = $path;
        $this->load->view($this->container, $this->_data);
    }

}

class FrontEnd_Controller extends MY_Controller {

    function FrontEnd_Controller() {
        parent::MY_Controller();
        $this->load->library('cart');
        $header['page'] = "header";
        $footer['page'] = "footer";
        $sidebar['page'] = "sidebar";
        $this->load->model('home_m');
        $this->_data['sidebar'] = $sidebar;
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->_data['is_banner'] = false;
        $this->_data['is_sidebar'] = true;
        $this->_data['page_title'] = "Home";
    }

    function translate() {
        if ($this->session->userdata('langue') == true) {
            $key = $this->session->userdata('langue');
        } else {
            $key = "fr";
            $this->session->set_userdata('langue', $key);
        }
        $this->_data['langue'] = $this->home_m->translate($key);
    }

}

class Admin_Controller extends MY_Controller {

    function Admin_Controller() {
        parent::MY_Controller();
        $header['page'] = "admin/header";
        $footer['page'] = "admin/footer";
        $sidebar['page'] = "admin/sidebar";

        $this->load->model('admin_m');
        $this->_data['sidebar'] = $sidebar;
        $this->_data['header'] = $header;
        $this->_data['footer'] = $footer;
        $this->_data['is_sidebar'] = true;
        $this->_data['page_title'] = "Admin";
    }

}